﻿CREATE PROCEDURE [ServiceEngine].[GetDataEntityBySchemaObjectID]
@ID UNIQUEIDENTIFIER
AS
BEGIN
	SET NOCOUNT ON;

	SELECT	
			N.EntityID as ID, 
			N.[EntityName] as [Name], 
			N.EntityDescription as Description
	FROM	[ServiceEngine].Names N JOIN [ServiceEngine].SchemaObjects SO ON SO.DataEntityID = N.EntityID
			
	WHERE	N.[EntityTypeID] = 20 AND SO.SchemaObjectID = @ID AND SO.DateRevised IS NULL
END
